import { router } from '@ruifox-cms/utils'

const routes = [
  {
    path: '/recruitment/user',
    name: 'Layout',
    redirect: '/recruitment/user/home',
    component: () => import('@/views/layout/UserLayout.vue'),
    meta: {
      title: '首页',
      whiteList: true
    },
    children: [
      {
        path: 'home',
        name: 'RecruitmentUserHome',
        component: () => import('@/views/recruitment/user/Home.vue'),
        meta: {
          title: '首页',
          whiteList: true,
          hideBreadcrumb: true // 隐藏面包屑
        }
      },
      {
        path: 'notice',
        name: 'RecruitmentUserNotice',
        component: () => import('@/views/recruitment/user/Notice.vue'),
        meta: {
          title: '招聘公告',
          whiteList: true,
          parent: 'Layout' 
        }
      },
      {
        path: 'jobs',
        name: 'RecruitmentUserJobs',
        component: () => import('@/views/recruitment/user/Jobs.vue'),
        meta: {
          title: '职位搜索',
          whiteList: true,
          parent: 'Layout' 
        }
      },
      {
        path: 'apply',
        name: 'RecruitmentUserApply',
        component: () => import('@/views/recruitment/user/Apply.vue'),
        meta: {
          title: '职位详情',
          whiteList: true,
          parent: 'RecruitmentUserJobs' 
        }
      },
      // 用户中心
      {
        path: '/recruitment/user/userInfo',
        name: 'UserInfoLayout',
        redirect: '/recruitment/user/userInfo/profile',
        component: () => import('@/views/recruitment/user/userInfo/UserInfoLayout.vue'),
        meta: {
          title: '个人中心',
          whiteList: false,
          parent: 'Layout' 
        },
        children: [
          {
            path: 'profile',
            name: 'RecruitmentUserProfile',
            component: () => import('@/views/recruitment/user/userInfo/UserProfile.vue'),
            meta: { 
              title: '个人信息',
              whiteList: false,
              parent: 'UserInfoLayout' 
            }
          },
          {
            path: 'applications',
            name: 'RecruitmentApplicationRecords',
            component: () => import('@/views/recruitment/user/userInfo/ApplicationRecords.vue'),
            meta: { 
              title: '投递记录',
              whiteList: false,
              parent: 'UserInfoLayout' 
            }
          },
          {
            path: 'favorites',
            name: 'RecruitmentFavoriteJobs',
            component: () => import('@/views/recruitment/user/userInfo/FavoriteJobs.vue'),
            meta: { 
              title: '收藏职位',
              whiteList: false,
              parent: 'UserInfoLayout' 
            }
          }
        ]
      }
    ]
  }
]

routes.forEach(route => {
  router.addRoute(route)
})

export default router
